﻿#include "dxstdafx.h"
#include "LocalisationIO.h"

bool CLocalisationReaderHandle::HandleString(const std::wstring& key, const std::wstring& str)
{
	CHECK_RE_FALSE(m_Container);
	auto iterInsert = m_Container->insert(std::make_pair(key, str));
	if (!iterInsert.second)
	{
		// 插入失败 说明重复
		if (iterInsert.first->second.empty())
		{
			// 值是空 覆盖就好
			iterInsert.first->second = str;
		}
		else
		{
			CString strError;
			strError.Format(L"Key '%s' is repeat!", key);
			CommonFunc::ErrorMessageBox(strError);
			return false;
		}
	}
	return true;
}
